/*
 * CtpMarketData.h
 *
 *  Created on: 2012-12-27
 *      Author: jli
 */

#ifndef CTPMARKETDATA_H_
#define CTPMARKETDATA_H_

#include "ThostFtdcMdApi.h"




class CtpMarketDataSpi: public CThostFtdcMdSpi {
private:
	CThostFtdcMdApi *mdApi;
    char *brokerID;
	char *userName;
	char *userPwd;
	char *instrument;
	
public:
	CtpMarketDataSpi( CThostFtdcMdApi *userApi, char *broker, char *name, char *pwd, char *instr  );
	virtual ~CtpMarketDataSpi();


	void OnFrontConnected();

	void CtpMarketDataSpi::OnFrontDisconnected(int nReason);
	int ReqUserLogin();
	void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	bool IsErrorRspInfo( CThostFtdcRspInfoField *rspInfo );

	void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData);
};


#endif /* CTPMARKETDATA_H_ */
